function [im2]=drawpicture(loadaddress,filename_pre,files_if,mode)
%draw picture

% clc,clear
% loadaddress='E:\�׳���\Rb87Files\Rb87spintexturedata\';  %address of files
% filename_pre='ascOD17639test_';      %expanded-name of files
% %files_if=[initialnumber finalnumber]
% files_if=[127 137];
% %if pictures includes 3 images,mode='3picture',else mode='1picture'
% mode='1picture';
% addpath E:\OneDrive\�׳���\learnfiles\matlab����\Rb87Programs\ExperimentBasicFunction

im2=struct('data',zeros(1024,1024));
k=1;
switch mode
    case '3picture'
        files_order=files_if(1);
        while files_order<=files_if(2)             
              absimages=loadPhoto(photoName(loadaddress,filename_pre,files_order,'.asc'));      %picture 1
              refimages=loadPhoto(photoName(loadaddress,filename_pre,files_order,'bg.asc'));    %picture 2
              nolight=loadPhoto(photoName(loadaddress,filename_pre,files_order,'nolight.asc')); %picture 3
              
 
              absnolight_images=((absimages-nolight)+abs(absimages-nolight))/2+1;  %picture 4
              refnolight_images=((refimages-nolight)+abs(refimages-nolight))/2+1;   %picture 5
              im2(k).data=log(refnolight_images./absnolight_images);                %picture 6
              k=k+1;
              files_order=files_order+1;
         end
    case '1picture'
        for files_order=files_if(1):files_if(2)
             im2(k).data=loadPhoto(photoName(loadaddress,filename_pre,files_order,'.asc'));
             k=k+1;
        end
end

% for i=1:11
%     figure(i)
%     imagesc(im2(i).data)
% end

